/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Entity;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author dukynguyen
 */
@Entity
@Table(name = "Event", catalog = "eProjectNational_Level_Paper", schema = "dbo")
@NamedQueries({
    @NamedQuery(name = "Event.findAll", query = "SELECT e FROM Event e"),
    @NamedQuery(name = "Event.findByEvID", query = "SELECT e FROM Event e WHERE e.evID = :evID"),
    @NamedQuery(name = "Event.findByEvName", query = "SELECT e FROM Event e WHERE e.evName = :evName"),
    @NamedQuery(name = "Event.findByDateStart", query = "SELECT e FROM Event e WHERE e.dateStart = :dateStart"),
    @NamedQuery(name = "Event.findByDateEnd", query = "SELECT e FROM Event e WHERE e.dateEnd = :dateEnd"),
    @NamedQuery(name = "Event.findByDateCreate", query = "SELECT e FROM Event e WHERE e.dateCreate = :dateCreate"),
    @NamedQuery(name = "Event.findByWinner", query = "SELECT e FROM Event e WHERE e.winner = :winner"),
    @NamedQuery(name = "Event.findByStatus", query = "SELECT e FROM Event e WHERE e.status = :status"),
    @NamedQuery(name = "Event.findByIDelete", query = "SELECT e FROM Event e WHERE e.iDelete = :iDelete")})
public class Event implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue
    @Basic(optional = false)
    @Column(name = "EvID", nullable = false)
    private Integer evID;
    @Column(name = "EvName", length = 100)
    private String evName;
    @Lob
    @Column(name = "EvDescription", length = 1073741823)
    private String evDescription;
    @Lob
    @Column(name = "EvImage", length = 1073741823)
    private String evImage;
    @Column(name = "DateStart", length = 50)
    private String dateStart;
    @Column(name = "DateEnd", length = 50)
    private String dateEnd;
    @Column(name = "DateCreate")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dateCreate;
    @Column(name = "Winner", length = 50)
    private String winner;
    @Column(name = "Status")
    private Boolean status;
    @Column(name = "iDelete")
    private Boolean iDelete;
    @OneToMany(mappedBy = "event")
    private Collection<Document> documentCollection;
    @JoinColumn(name = "CaID", referencedColumnName = "CaID")
    @ManyToOne
    private Category category;
    @OneToMany(mappedBy = "event")
    private Collection<Comment> commentCollection;
    @OneToMany(mappedBy = "event")
    private Collection<Payment> paymentCollection;

    public Event() {
    }

    public Event(Integer evID) {
        this.evID = evID;
    }

    public Integer getEvID() {
        return evID;
    }

    public void setEvID(Integer evID) {
        this.evID = evID;
    }

    public String getEvName() {
        return evName;
    }

    public void setEvName(String evName) {
        this.evName = evName;
    }

    public String getEvDescription() {
        return evDescription;
    }

    public void setEvDescription(String evDescription) {
        this.evDescription = evDescription;
    }

    public String getEvImage() {
        return evImage;
    }

    public void setEvImage(String evImage) {
        this.evImage = evImage;
    }

    public String getDateStart() {
        return dateStart;
    }

    public void setDateStart(String dateStart) {
        this.dateStart = dateStart;
    }

    public String getDateEnd() {
        return dateEnd;
    }

    public void setDateEnd(String dateEnd) {
        this.dateEnd = dateEnd;
    }

    public Date getDateCreate() {
        return dateCreate;
    }

    public void setDateCreate(Date dateCreate) {
        this.dateCreate = dateCreate;
    }

    public String getWinner() {
        return winner;
    }

    public void setWinner(String winner) {
        this.winner = winner;
    }

    public Boolean getStatus() {
        return status;
    }

    public void setStatus(Boolean status) {
        this.status = status;
    }

    public Boolean getIDelete() {
        return iDelete;
    }

    public void setIDelete(Boolean iDelete) {
        this.iDelete = iDelete;
    }

    public Collection<Document> getDocumentCollection() {
        return documentCollection;
    }

    public void setDocumentCollection(Collection<Document> documentCollection) {
        this.documentCollection = documentCollection;
    }

    public Category getCategory() {
        return category;
    }

    public void setCategory(Category category) {
        this.category = category;
    }

    public Collection<Comment> getCommentCollection() {
        return commentCollection;
    }

    public void setCommentCollection(Collection<Comment> commentCollection) {
        this.commentCollection = commentCollection;
    }

    public Collection<Payment> getPaymentCollection() {
        return paymentCollection;
    }

    public void setPaymentCollection(Collection<Payment> paymentCollection) {
        this.paymentCollection = paymentCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (evID != null ? evID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Event)) {
            return false;
        }
        Event other = (Event) object;
        if ((this.evID == null && other.evID != null) || (this.evID != null && !this.evID.equals(other.evID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entity.Event[evID=" + evID + "]";
    }

}
